<?php
if(defined("IZ_ACCNAME")) {
  izsql();
  $coloursql = "SELECT * FROM users WHERE color != 'default'";
  if(IZ_CALMODE == 'mysql') {
    if($_SESSION['MYSQLi']) {
      global $dblink;
      $res = $dblink->query($coloursql);
      if($res) {
        while($row = $res->fetch_object()) {
          echo '.item-',$row->name,', .item-',$row->name,' a { color: #',$row->color,' !important; }',"\n";
        }
      }
    } else {
      $res = mysql_query($coloursql);
      if($res) {
        while($row = mysql_fetch_object($res)) {
          echo '.item-',$row->name,', .item-',$row->name,' a { color: #',$row->color,' !important; }',"\n";
        }
      }
    }
  } elseif(IZ_CALMODE == 'postgre') {
    $coloursql = "SELECT * FROM \"users\" WHERE \"color\" != 'default'";
    $res = pg_query($coloursql);
    if($res) {
      while($row = pg_fetch_object($res)) {
        echo '.item-',$row->name,', .item-',$row->name,' a { color: #',$row->color,' !important; }',"\n";
      }
    }
  } elseif(IZ_CALMODE == 'msq') {
    $res = mssql_query($coloursql);
    if($res) {
      while($row = mssql_fetch_object($res)) {
        echo '.item-',$row->name,', .item-',$row->name,' a { color: #',$row->color,' !important; }',"\n";
      }
    }
}
} else {
  // Directly accessed
  header('Location: ../');
} ?>